xi2: Reset scroll valuators on synthesized crossing events
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 28 Mar 2013 13:57:00 +0000 (14:57 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Wed, 10 Apr 2013 18:18:09 +0000 (20:18 +0200)
On crossing events resulting from moving windows (eg. workspace switch),
deviceid equals sourceid, so make those reset scroll valuators on all
slave devices to avoid misleading jumps in scroll events

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=690275

gdk/x11/gdkdevicemanager-xi2.c

index 660d0f031d54d8eeaee4d7de334a35fd8b50cb76..db2ba2833c454b50423ccacada2b5fc4c408f6f1 100644 (file)
@@ -1555,7 +1555,20 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
         source_device = g_hash_table_lookup (device_manager->id_table,
                                              GUINT_TO_POINTER (xev->sourceid));
         gdk_event_set_source_device (event, source_device);
-        _gdk_device_xi2_reset_scroll_valuators (GDK_X11_DEVICE_XI2 (source_device));
+
+       if (gdk_device_get_device_type (source_device) != GDK_DEVICE_TYPE_MASTER)
+          _gdk_device_xi2_reset_scroll_valuators (GDK_X11_DEVICE_XI2 (source_device));
+        else
+          {
+            GList *slaves, *l;
+
+            slaves = gdk_device_list_slave_devices (source_device);
+
+            for (l = slaves; l; l = l->next)
+              _gdk_device_xi2_reset_scroll_valuators (GDK_X11_DEVICE_XI2 (l->data));
+
+            g_list_free (slaves);
+          }
 
         event->crossing.mode = translate_crossing_mode (xev->mode);
         event->crossing.detail = translate_notify_type (xev->detail);